const { resolve } = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: './src/index.js',
  output: {
    filename: "js/[name].bundle.js",
    path: resolve(__dirname, 'dist')
  },
  module: {

  },
  plugins: [
    // html 压缩
    new HtmlWebpackPlugin({
      template: "./src/template.html",
      // 压缩html代码
      minify: {
        // 移除空格
        collapseWhitespace: true,
        // 移除注释
        removeComments: true
      }
    })
  ],
  // js 压缩只需要把 mode 改成 production
  mode: "development"
}